//案例: 演示String和StringBuilder之间的相互转换.
public class Demo06 {
    public static void main(String[] args) {
        //需求1: String -> StringBuilder
        //通过: StringBuilder的构造方法实现.
        String s1 = "abc";
        StringBuilder sb = new StringBuilder(s1);
        System.out.println("String -> StringBuilder: " + sb);
        System.out.println("------------------------");

        //需求2: StringBuilder -> String
        //通过 StringBuilder的toString()方法, 即:  public String toString();
        String s2 = sb.toString();
        System.out.println("StringBuilder -> String: " + s2);
    }
}
